package cn.tedu.mapper;

import cn.tedu.pojo.Chapter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ChapterMapper extends BaseMapper<Chapter> {
    @Select("select c.chapter from chapter c where id = (" +
            "select n.novel_id from novel_chapter n " +
            "where novel_id = #{novelId})" +
            "group by c.created_time")
    List<Chapter> getChapterByNovelId(Integer novelId);
    @Select("select content from chapter where id = #{chapterId}")
    String getContentByChapterId(Integer chapterId);
}
